//
//  AppDelegate+Expansion.m
//  YunHaiManage
//
//  Created by zhangbolin on 2021/12/17.
//

#import "AppDelegate+Expansion.h"

@implementation AppDelegate (Expansion)

- (void)configApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self configureDefaultAppearance];
}

/**
 * 默认设置导航栏
 */
- (void)configureDefaultAppearance
{
    //  系统默认颜色配置
    [[UINavigationBar appearance] setTintColor:[UIColor qjn_colorWithHexString:@"#ff7e3e"]];
    
    //  系统默认返回按钮配置
   
    // ios 11 需要通过这种方式设置返回按钮  by:jinfeng.peng 2017-11-27
    //这里不需要判断iOS11的情况、这些接口最低可以适配iOS7  ai.chen 2018-06-29
    UIImage *backImage = [[UIImage imageNamed:@"common_navigation_icon_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [[UINavigationBar appearance] setBackIndicatorImage:backImage];
    [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backImage];
    [[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBackgroundImage:[UIImage qjn_imageWithColor:[UIColor whiteColor]] forBarMetrics:UIBarMetricsDefault];
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-200, 0) forBarMetrics:UIBarMetricsDefault];
    
    
    // 系统工具栏背景颜色配置（白色）
    [[UIToolbar appearance] setBackgroundImage:[UIImage qjn_imageWithColor:[UIColor colorWithWhite:1 alpha:0.99f] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 44.0f)]
                            forToolbarPosition:UIBarPositionAny
                                    barMetrics:UIBarMetricsDefault];
    UIImage *toolBarShadowImage = [UIImage gradientImageWithStartColor:[UIColor colorWithWhite:0 alpha:0.03f]
                                                              endColor:[UIColor colorWithWhite:0 alpha:0.15f] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 3.0f / [UIScreen mainScreen].scale)];
    [[UIToolbar appearance] setShadowImage:toolBarShadowImage forToolbarPosition:UIBarPositionBottom];
    
    // 设置导航栏底部线条
    UIImage *shadowImage = [UIImage gradientImageWithStartColor:[UIColor colorWithWhite:0 alpha:0.10f]
                                                       endColor:[UIColor colorWithWhite:0 alpha:0.04f] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 3.0f / [UIScreen mainScreen].scale)];
    [[UINavigationBar appearance] setShadowImage:shadowImage];
    
    // 设置导航条字体属性
    [UINavigationBar appearance].titleTextAttributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:18.0f],NSForegroundColorAttributeName:[UIColor colorWithWhite:0x22 / 0xff alpha:1.0f]};
    
}

@end
